﻿using System.Reflection;

namespace Mido.UiModules.AboutDialogModule
{
	public static class AboutViewModel
	{
		public static string ProductVersion
		{
			get
			{
				Assembly assembly = Assembly.GetEntryAssembly();
				if (assembly != null)
				{
					object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
					
					if (customAttributes.Length > 0)
						return ((AssemblyFileVersionAttribute)customAttributes[0]).Version;
				}

				return string.Empty;
			}
		}

		public static string ProductName
		{
			get
			{
				Assembly assembly = Assembly.GetEntryAssembly();
				if (assembly != null)
				{
					object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);

					if (customAttributes.Length > 0)
						return ((AssemblyProductAttribute)customAttributes[0]).Product;
				}

				return string.Empty;
			}
		}
	}
}
